package cn.gjxblog.controller;

import cn.gjxblog.common.model.HttpResult;
import cn.gjxblog.service.FileService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author gjx
 * @version v1.0
 * @Description
 * @date 2018/12/7 15:51
 */
@RequestMapping("/file")
@RestController
public class FileController {

    @Resource
    private FileService fileService;

    @PostMapping("/upload")
    public HttpResult upload(@RequestBody byte[] data, @RequestParam("fileName") String fileName){
        String upload = fileService.upload(data,fileName);
        return HttpResult.success(upload);
    }
}
